package com.ysd.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.ysd.entity.Read_room;

public interface Read_roomRepository extends JpaRepository<Read_room, Integer>{
	
	@Transactional
	@Modifying
	@Query("update Read_room r set r.name=?1 where id=?2")
	int setFixedRoomNameFor(String name,Integer id);
	
	@Modifying
	@Transactional
	@Query(value = "insert into Read_room(name) value(?1)", nativeQuery = true)
	int insertRoom(String name);
	
	@Modifying
	@Transactional
	@Query(value = "delete from Read_room where id=?1 ", nativeQuery=true)
	int delectRoomByid(Integer id);
	
	
}
